const koaRouter = require('@koa/router')
const { create, remove, update, get, getList, search } = require('../controller/newsController')
const { verifAuth } = require('../middleware/login.middleware')
const newsRouter = new koaRouter({ prefix: '/news' })
// 增加
newsRouter.post('/', verifAuth, create)
//查

// 根据传入type查询新闻动态列表,type为路径参数/news/search?type=1
newsRouter.get('/search', search)
newsRouter.get('/:id', get)
newsRouter.get('/', getList)
// // 改
newsRouter.post('/:id', verifAuth, update)
// // 删
newsRouter.delete('/:id', verifAuth, remove)



module.exports = newsRouter
